class Student:

    def __init__(self, name, age):
        self.name = name  # self.name 实例属性
        self.age = age

    # 实例方法
    def eat(self):
        print("在吃饭")


stu1 = Student('张三', 20)
stu1.eat()
print(stu1.name, stu1.age)

print('-----------------------------')
# 与26行功能相同
Student.eat(stu1)
